package com.sip.stream.gbstack.Model;

import com.sip.stream.gbstack.GS28181SDK;
import com.sip.stream.gbstack.GS28181SDKConfig;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class GS28181PosNotify {

    private String time = "";
    private double longitude = 0.0d;
    private double latitude = 0.0d;
    private double speed = 0.0d;
    private double direction = 0.0d;
    private int altitude = 0;
    private String gbCode = null;

    public String getTime() {
        return this.time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public double getLongitude() {
        return this.longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getLatitude() {
        return this.latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getSpeed() {
        return this.speed;
    }

    public void setSpeed(double speed) {
        this.speed = speed;
    }

    public double getDirection() {
        return this.direction;
    }

    public void setDirection(double direction) {
        this.direction = direction;
    }

    public int getAltitude() {
        return this.altitude;
    }

    public void setAltitude(int altitude) {
        this.altitude = altitude;
    }

    public String getGbCode() {
        return this.gbCode;
    }

    public void setGbCode(String gbCode) {
        this.gbCode = gbCode;
    }

    public static class Builder {
        private GS28181PosNotify buildTarget = new GS28181PosNotify();

        public GS28181PosNotify build() {
            return this.buildTarget;
        }

        public Builder setTime(Date date) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(GS28181SDKConfig.GS28181SDK_DATE_FORMAT, Locale.CHINA);
            this.buildTarget.time = simpleDateFormat.format(date);
            return this;
        }

        public Builder setCurrentTime() {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(GS28181SDKConfig.GS28181SDK_DATE_FORMAT, Locale.CHINA);
            this.buildTarget.time = simpleDateFormat.format(new Date());
            return this;
        }

        public Builder setPostion(double longitude, double latitude) {
            this.buildTarget.longitude = longitude;
            this.buildTarget.latitude = latitude;
            return this;
        }

        public Builder setCachePostion() {
            this.buildTarget.longitude = GS28181SDK.getInstance().getStatus().getLongitude();
            this.buildTarget.latitude = GS28181SDK.getInstance().getStatus().getLatitude();
            return this;
        }

        public Builder setSpeed(double speed) {
            this.buildTarget.speed = speed;
            return this;
        }

        public Builder setGbCode(String gbCode) {
            this.buildTarget.gbCode = gbCode;
            return this;
        }

        public Builder setDirection(double direction) {
            this.buildTarget.direction = direction;
            return this;
        }

        public Builder setAltitude(int altitude) {
            this.buildTarget.altitude = altitude;
            return this;
        }
    }
}
